package com.example.i

import com.example.aloy.activity.BottomNavActivity
import com.example.aloy.fragment.BasicFragment
import com.example.aloy.fragment.first.HomeFragment
import com.example.aloy.fragment.first.HotFragment
import com.example.aloy.fragment.first.MeFragment


class MainActivity : BottomNavActivity(){
    private val homeFragment by lazy { HomeFragment() } // 首页
    private val hotFragment by lazy { HotFragment() } // 热点
    private val meFragment by lazy { MeFragment() } // 我的

    override fun getFragmentList(): ArrayList<BasicFragment> {
        val fragmentList= ArrayList<BasicFragment>()
        return fragmentList.apply {
            add(homeFragment)
            add(hotFragment)
            add(meFragment)
        }
    }

    override fun getBottomNavMenu(): Int {
        return R.menu.bottom_nav
    }

    override fun getCustomizedActionBarID(): Int {
        return R.layout.action_bar
    }

    override fun onNavigationItemSelected(itemID: Int) {
        when (itemID) {
            R.id.home -> switchFragment(0)
            R.id.hot -> switchFragment(1)
            R.id.me -> switchFragment(2)
        }
    }
}
